package services

import (
	"fmt"

   "huaxrobot/config"
   "huaxrobot/tools"
   
)

//发送任务到kafka
func SendTask(message string)  {
	kafkaclient := tools.KAFKA
	TOPICTASK := config.CONFIG.GetString("kafka.topictask")
	kafkaclient.Producer(TOPICTASK, message)
}

//接收任务测试结果
func CollectResult()  {
	kafkaclient := tools.KAFKA
	TOPICTASK := config.CONFIG.GetString("kafka.topicresult")
	kafkaclient.Consumer(TOPICTASK, Onmessage)
}

//收到消息的回调函数
func Onmessage(message string) {
	fmt.Println("Im callback", message)
}